package com.example.wm.controller;

import com.example.wm.common.Result;
import com.example.wm.common.ResultData;
import com.example.wm.entity.Wxmassage;

import com.example.wm.service.WxMessageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.UUID;

@Slf4j
@RestController
@RequestMapping("/WxMassege")
public class WxMassegeController {
    @Resource
    private WxMessageService wxMessageService;
    @PostMapping("insertwx")
//    请假
    public Result<String> insertWxmassge(@RequestBody Wxmassage wxmassage){

        DateTimeFormatter dfDateTime = DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH:mm:ss");
        wxmassage.setTime(dfDateTime.format(LocalDateTime.now()));
        wxMessageService.save(wxmassage);
        return ResultData.success("插入成功");
    }
    //请假审批
    @PostMapping("/Wxmassgeapprove")
    public Result<String> insertWxmassge_sh(@RequestBody Wxmassage wxmassage){

        DateTimeFormatter dfDateTime = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        wxmassage.setTime(dfDateTime.format(LocalDateTime.now()));
        wxMessageService.save(wxmassage);
        return ResultData.success("插入成功");

    }

}
